// 请使用以下的 getBaseUrl() 和 getStaticUrl() 方法获取 baseUrl 和 staticUrl，不要直接使用 settings.dev.baseUrl 和 settings.dev.staticUrl
const settings = {
  debug: true, //是否打印请求日志
  // 开发环境（开发版小程序）
  dev: {
    baseUrl: "https://kou.gdzmtech.com:1443/api-client/", //线上
    staticUrl: "https://kou.gdzmtech.com:1443/api-client", //线上
    nginxUrl: "https://kou.gdzmtech.com:1443",
    websocketUrl: "wss://kou.gdzmtech.com:1443/mq/chat", //websocket请求地址
    
    // websocketUrl: "wss://", //websocket请求地址
    
    // baseUrl: "http://192.168.6.24:9100/api-client/", //建云
    // staticUrl: "http://192.168.6.24:9100/api-client", //建云
    // websocketUrl: "wss://29m6e62995.goho.co/mq/chat",
    // nginxUrl: "https://29m6e62995.goho.co",
    
// nginxUrl: "http://192.168.6.24:9100",
    // baseUrl: "http://192.168.7.205:9100/api-client/", //谢俊颖
    // staticUrl: "http://192.168.7.205:9100/api-client", //谢俊颖
    
    //反向代理域名
    // baseUrl: "https://29m6e62995.goho.co/api-client/",
    // staticUrl: "https://29m6e62995.goho.co/api-client",
    // websocketUrl: "wss://29m6e62995.goho.co/mq/chat",
    // nginxUrl: "https://29m6e62995.goho.co",
  },
  // 生产环境（release版和体验版小程序）
  product: {
    //本地环境
    // baseUrl: "https://29m6e62995.goho.co/api-client/",
    // staticUrl: "https://29m6e62995.goho.co/api-client",
    // websocketUrl: "wss://29m6e62995.goho.co/mq/chat",
    // nginxUrl: "https://29m6e62995.goho.co",
    
    baseUrl: "https://kou.gdzmtech.com:1443/api-client/",
    staticUrl: "https://kou.gdzmtech.com:1443/api-client/",
    websocketUrl: "wss://kou.gdzmtech.com:1443/mq/chat", //websocket请求地址
    nginxUrl: "https://kou.gdzmtech.com:1443",
    
// baseUrl: "http://192.168.6.24:9100/api-client/",
    // staticUrl: "http://192.168.6.24:9100/api-client",
  },
  tokenKey: "k-Authorization",
  nginxUrlSuffix: "https://kou.gdzmtech.com/", // nginx静态文件地址
}

//拼接放在nginx上的图片地址
export function getShowNginxPicUrl(fileName) {
  if (fileName.startsWith("http")) {
    return fileName
  }
  return settings.nginxUrlSuffix + "pic/" + fileName
}

export function getBaseUrl() {
  if (["develop"].includes(getEnv())) {
    return settings.dev.baseUrl
  } else {
    return settings.product.baseUrl
  }
}

export function getStaticUrl() {
  if (["develop"].includes(getEnv())) {
    return settings.dev.staticUrl
  } else {
    return settings.product.staticUrl
  }
}

export function getNginxUrl() {
  if (["develop"].includes(getEnv())) {
    return settings.dev.nginxUrl
  } else {
    return settings.product.nginxUrl
  }
}

export function getWebsocketUrl() {
  if (["develop"].includes(getEnv())) {
    return settings.dev.websocketUrl
  } else {
    return settings.product.websocketUrl
  }
}

//获取当前的小程序版本，开发版 develop 体验版 trial 正式版 release
export function getEnv() {
  const accountInfo = uni.getAccountInfoSync()
  return accountInfo.miniProgram.envVersion
}

export default settings
